import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { getGroup, getGroupExpenses } from '@/lib/api' import { cn } from '@/lib/utils' import { ChevronRight, Plus } from 'lucide-react' import Link from 'next/link' import { notFound } from 'next/navigation' export default async function GroupExpensesPage({ params: { groupId }, }: { params: { groupId: string } }) { const group = await getGroup(groupId) if (!group) notFound() const expenses = await getGroupExpenses(groupId) return (
Expenses Here are the expenses that you created for your group.
{expenses.length > 0 ? ( expenses.map((expense) => (
{expense.title}
Paid by{' '} { group.participants.find((p) => p.id === expense.paidById) ?.name } {' '} for{' '} {expense.paidFor.map((paidFor, index) => ( { group.participants.find( (p) => p.id === paidFor.participantId, )?.name } ))}
{group.currency} {expense.amount.toFixed(2)}
)) ) : (

Your group doesn’t contain any expense yet.{' '}

)} {/* Title Paid by Paid for Amount {expenses.map((expense) => ( {expense.title} { group.participants.find( (p) => p.id === expense.paidById, )?.name } {expense.paidFor.map((paidFor, index) => ( { group.participants.find( (p) => p.id === paidFor.participantId, )?.name } ))} {group.currency} {expense.amount.toFixed(2)} ))}
) : (
Your group doesn’t have any expense yet.
)} */}
) }